package com.sun.mapper;

import com.sun.entity.SetmealArtwork;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealArtworkMapper {

    /**
     * 根据艺术品id查询对应的套餐id
     * @param ids
     * @return
     */
    //select setmeal_id from setmeal_artwork where artword_id in (xxxxxxx)
    List<Long> getSidsByAids(List<Long> ids);

    /**
     * 批量保存套餐和艺术品的关联关系
     * @param setmealArtworkes
     */
    void insertBatch(List<SetmealArtwork> setmealArtworkes);

    /**
     * 根据套餐id删除套餐和艺术品的关联关系
     * @param setmealId
     */
    @Delete("delete from setmeal_artwork where setmeal_id = #{setmealId}")
    void deleteBySetmealId(Long setmealId);

    /**
     * 根据套餐id查询套餐和艺术品的关联关系
     * @param setmealId
     * @return
     */
    @Select("select * from setmeal_artwork where setmeal_id = #{setmealId}")
    List<SetmealArtwork> getBySetmealId(Long setmealId);
}
